package com.andy.tag;

import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

public class BlogTag  extends TagSupport{

	
	private String text;
	
	
	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	@Override
	public int doEndTag() throws JspException {

		
		
		
		
		try {
			
			System.out.println("text:"+getText());
			if(text==null ||"".equals(text))
			{
				
				text="";
				this.pageContext.getOut().write(text);
				
			}else
			{
				
				this.pageContext.getOut().write(text.replaceAll("<[^>]+>", " "));
				
			}
			
		
		
		} catch (IOException e) {			
			e.printStackTrace();
		}
		
		
		return EVAL_PAGE;
	}

	@Override
	public int doStartTag() throws JspException {		
		return  EVAL_BODY_INCLUDE;
	
	
	 

}
	
}
